package cj.primariaiquest.ws.xmlConfig;

import java.util.Random;

import org.springframework.stereotype.Component;

import cj.primariaiquest.ws.entrypoint.TicketGateway;

public class Office {

	private Random random = new Random();
	private String officeName;
	
	public Office(){}
	
	public Office(String officeName){
		this.officeName = officeName;
	}

	public Ticket processTicket(Ticket ticket) throws Exception {
		int sleepTime = random.nextInt(10) * 500;
		Thread.sleep(sleepTime);
		ticket.setOffice(officeName);
		// System.out.println(Thread.currentThread().getName() + " -> " +
		// sleepTime);
		// System.out.println(Thread.currentThread().toString());
		System.out.println("Processing ticket:");
		return ticket;

	}

//	public String getOfficeName() {
//		String[] threadName = Thread.currentThread().getName().split("-");
//		String deskName = officeName + threadName[1] + ":";
//		return deskName;
//
//	}

		
	
}
